/**
 * Type of image editing operations
 */
export type ImageEditOperation =
    /**
     * Resize an image
     */
    | 'resize'

    /**
     * Rotate an image
     */
    | 'rotate'

    /**
     * Crop an image
     */
    | 'crop'

    /**
     * Flip an image
     */
    | 'flip';

/**
 * Define the common operation of an image editor
 */
export interface ImageEditor {
    /**
     * Check if the given editing operation is allowed on current selected image
     * @param operation The operation to check
     * @returns True if the operation is allowed, otherwise false
     */
    isOperationAllowed(operation: ImageEditOperation): boolean;

    /**
     * Check if the given image can be regenerated by this image editor
     * @param image The image to check
     * @returns True if the image can be regenerated, otherwise false
     */
    canRegenerateImage(image: HTMLImageElement): boolean;

    /**
     * Rotate selected image to the given angle (in rad)
     * @param angleRad The angle to rotate to
     */
    rotateImage(angleRad: number): void;

    /**
     * Flip the image.
     * @param direction Direction of flip, can be vertical or horizontal
     */
    flipImage(direction: 'vertical' | 'horizontal'): void;

    /**
     * Start to crop selected image
     */
    cropImage(): void;
}
